package com.bw.module_home.property.model

import com.bw.lib_common.entity.Res
import com.bw.module_home.property.api.PropertyApiService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

class PropertyRepository @Inject constructor() {
    @Inject
    @PropertyModule.CommonHomeApi
    lateinit var api: PropertyApiService

    fun getTenantList(): Flow<Res<TenantEntity>> = flow {
        emit(api.getTenantList())
    }.flowOn(Dispatchers.IO)
    fun getPropertyList(regionId: Int): Flow<Res<PropertyEntity>> = flow {
        emit(api.getPropertyList(regionId))
    }.flowOn(Dispatchers.IO)
}